package com.liusaidh.controller;

import com.liusaidh.result.Result;
import com.liusaidh.service.AddService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author liusaidh
 * @date 2024/7/6 8:24
 * @description
 */
@Api(tags = "新增的功能")
@Controller
@ResponseBody
public class AddController {

    @Resource
    private AddService addService;

    @ApiOperation("按类型获取文章")
    @GetMapping("/blog/getBlogByType")
    public Result getBlogByType(@ApiParam("类型的id") @RequestParam("id") Integer id){
        return addService.getBlogByType(id);
    }

    @ApiOperation("获取全部类型")
    @GetMapping("/blog/getAllType")
    public Result getAllType(){
       return addService.getAllType();
    }


}
